package com.dgut.app.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dgut.app.service.NoticeService;
import com.dgut.common.entity.Notice;
import com.dgut.common.enums.StatusEnum;
import com.dgut.common.mapper.NoticeMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author zyq
 * @Date 2022/4/8 11:41
 * @Description TODO
 * @Version 1.0
 **/
@Service
@Slf4j
public class NoticeServiceImpl implements NoticeService {
    private final NoticeMapper noticeMapper;
    public NoticeServiceImpl(NoticeMapper noticeMapper) {
        this.noticeMapper = noticeMapper;
    }


    @Override
    public List<Notice> listNotice() {
        QueryWrapper<Notice> query = new QueryWrapper<>();
        query.eq("state", StatusEnum.ACTIVE.getState());
        return noticeMapper.selectList(query);
    }

    @Override
    public Notice detail(Integer id) {
        return noticeMapper.selectById(id);
    }
}
